We've just created our model.
Remember, a function that gives us the desired output.
And right now, we want to improve our model.
So how can we do that?
Well, there's a few things, right?
If you remember.
All we've done is split our data into test and train.
But one of the things we can do as a machine learning engineer is decide how much data to give it to
train.
For example, if I decided that I want to 80% of the data to be the test data and only 20% to be the
shape or the train data that is the model will have less data to learn from.
If I hit run here and then let's run the rest of the blocks.
And then finally this one.
You see that my accuracy went down because I'm testing less data.
That's not very good, is it?
But what if we just give it less data to test?
What happens then?
If I click run on all of these and run here, I get 100% accuracy.
Does that mean that this is the best option?
Well, not really.
Right.
Because what happens now is that our test size, it's super, super small.
We only have 15 inputs that we're testing.
And yeah, we got 100% because we're learning from 135 data entries.
But because our test data is so small.
Although we got 15 out of 15, we can't be certain that our model.
Is that accurate because what we only tested it 15 times.
So this is a trade off of how much data do you want to train it with and how much data do you want to
test it with?
And that's why companies really value data.
The more data we have, the more we can train our models.
Okay.
What else can we do to improve this?
Well, another thing we can do is with the parameters in here.
Of the K nearest neighbours classifier is to perhaps do four if I hit run here and run again.
All right.
Ah, accuracy is a little bit lower now.
Because we're only testing for three types, three classes.
Ideally, we match that with our nearest neighbors.
Instead, if I do for what it actually does.
If we go to our nearest neighbors classifier, it's creating four segments for us to evaluate when instead
we only need the three iris flower types.
So let's keep that to three.
What other things can we do?
Well, another thing if we can collect more data is to perhaps have more columns.
Or parameters.
These are sometimes called features.
And the more features that a machine has to look at, the more information it can have.
That doesn't mean that the more features, the better, but it does mean that maybe if there was another
feature that we can look at for the flowers, there's a better model that we can build to predict what
type it is.
So that's another way to improve it.
Finally, the most interesting part is the actual algorithm that we use.
In this case, we used K neighbor's classifier, which I just told you that we're going to use, but
we can use any type of algorithm we want if we go to the site, could learn library.
There's different things that we can do.
For example, we can do a decision tree if we want to and use a decision tree classifier.
So how can we do that?
Well, I simply import something different.
I can import the decision tree classifier and instead of the K neighbors classifier, we now use the
decision tree classifier which we don't need to give it any parameters.
And if I now run this.
Oops.
I have to change this to tree.
So if I run this and we run our accuracy test.
All right, I get 9.33.
Pretty much the same as we had before.
And if we change this to 50, let's run this one more time.
.92.
But if you remember when we had the neighbors.
Classifier with the same parameters of test size of 0.2.
Our accuracy was actually better.
This time around, we got 100% accuracy, and you'll notice that this constantly shifts as we train
our model.
Sometimes it gets it right, sometimes it doesn't because it's constantly learning.
But you see that the accuracy with the K neighbour's classifier is a little bit better.
So this way we are able to improve our model so that we can now perhaps try these steps all over again
until our model is perfect enough, or at least close to perfect enough for us to make business decisions.
Very, very cool, right?
Let's do a few more things in the next video.